package zy.swagger.swaggerdemo.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: zhangy
 * @Date: 2018/9/13 11:44
 * @Description:
 */


@RestController
@RequestMapping(value = "/say")
@Api(value = "SayController | 一个用来测试swagger注解的控制器")
public class SayController {


    @RequestMapping(value = "/getUserName",method = RequestMethod.GET)
    @ApiOperation(value = "根据用户编号获取用户姓名",notes = "test: 仅1和2有正确返回")
    @ApiImplicitParam(paramType = "query",name = "userNumber",value = "用户编号")
    public String getUserName(@RequestParam Integer userNumber){

            if(userNumber == 1){
                return "zhangsan";
            }else if (userNumber == 2){
                return "lixing";
            }else{
                return "libshu";
            }

    }



}
